const createDB = () => {
	plus.sqlite.openDatabase({
		name: 'first',
		path: '_doc/hnjyw.db',
		success: function(e) {
			console.log('openDatabase success!');
		},
		fail: function(e) {
			console.log('openDatabase failed: ' + JSON.stringify(e));
		}
	});
}

const createUser = () => {
	plus.sqlite.executeSql({
		name: 'first',
		sql: 'create table if not exists userInfo("username" CHAR(110),"password" CHAR(100),"type" INT(1))',
		success: function(e) {
			console.log('executeSql success!');
			plus.sqlite.executeSql({
				name: 'first',
				sql: "insert into userInfo values('admin','123456','1')",
				success: function(e) {
					console.log('executeSql success!');
				},
				fail: function(e) {
					console.log('executeSql failed: ' + JSON.stringify(e));
				}
			});
		},
		fail: function(e) {
			console.log('executeSql failed: ' + JSON.stringify(e));
		}
	});

}

export default {
	createDB,
	createUser
}
